#ifndef _BUOLA_CV_FEATURES_CKEYPOINT_H
#define _BUOLA_CV_FEATURES_CKEYPOINT_H

#include <buola/image/format.h>

#include <opencv2/features2d/features2d.hpp>

namespace buola { namespace cvi {

class CKeyPoint
{
public:
    CKeyPoint(const cv::KeyPoint &pKP)
        :   mPoint(pKP.pt.x,pKP.pt.y)
        ,   mSize(pKP.size)
        ,   mAngle(pKP.angle)
        ,   mResponse(pKP.response)
        ,   mOctave(pKP.octave)
        ,   mClassID(pKP.class_id)
    {}

    const CPoint_f &Point() const   {   return mPoint;  }
    CPoint_i Point_i() const        {   return CPoint_i(mPoint);  }
    int Octave() const              {   return mOctave; }
    float Size() const              {   return mSize;   }
    
private:
    CPoint_f mPoint;
    float mSize;
    float mAngle;
    float mResponse;
    int mOctave;
    int mClassID;

    template<typename tSerializer>
    friend inline tSerializer &serialize(tSerializer &pS,const CKeyPoint &pK);
    template<typename tSerializer>
    friend inline tSerializer &deserialize(tSerializer &pS,CKeyPoint &pK);
};

template<typename tSerializer>
inline void serialize(tSerializer &pS,const CKeyPoint &pK)
{
    pS << pK.mPoint << pK.mSize << pK.mAngle << pK.mResponse << pK.mOctave << pK.mClassID;
}

template<typename tSerializer>
inline void deserialize(tSerializer &pS,CKeyPoint &pK)
{
    pS >> pK.mPoint >> pK.mSize >> pK.mAngle >> pK.mResponse >> pK.mOctave >> pK.mClassID;
}

/*namespace cvi*/ } /*namespace buola*/ }

#endif
